program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  pelement=^element;
  element=record
    value: integer;
    next: pelement;
  end;
var
  head: pelement;
  i, n, t: integer;
  fin: textFile;
procedure  AddToBegin(var head: pelement; num: integer;);
var
  tmp: pelement;
begin
  tmp:=head;
  new(head);
  head^.value:=num;
  head^.next:=tmp;
end;
procedure DeleteSecond(var head: pelement);
var
  current, tmp: pelement;
  n: integer;
begin
  current:=head;
  while (current^.next<>nil) do
  begin
    n:=n+1;
    current:=current^.next;
  end;
  current:=head;
  if (n+1 mod 2<>0) then
  begin
    while (current^.next<>nil) do
    begin
      tmp:=current^.next^.next;
      dispose(current^.next);
      current^.next:=tmp;
      current:=tmp;
    end else begin
      tmp:=current^.next^.next;
      dispose(current^.next);
      current^.next:=tmp;
      current:=tmp;
      if (current^.next=nil) then
        dispose(current);
    end;
  end;
end;
procedure Dobavka(head: pelement);
var
  current: pelement;
begin
  while (current<>nil) do
  begin
    current^.value:=current^.value+1;
  end;
end;
procedure Delete(head: pelement);
var
  tmp: pelement;
begin
  tmp:=head^.next;
  write(head^.value);
  dispose(head);
  head:=tmp;
end;
begin
  assignFile(fin,'input.txt');
  readln(fin,n);
  head:=nil;
  for i:=1 to n do
  begin
    read(fin,t);
    AddToBegin(head,t);
  end;
  readln;
  closeFile(fin);
  DeleteSecond(head);
  Dobavka(head);
  for i:=1 to n do
  begin
    Delete(head);
  end;
  readln;
end.
